<template>
	<view v-if="qidongye == 1">
		<view class="contents"></view>
	</view>
	<view v-else>
		<view class="content">
			<swiper :autoplay="true" :interval="3000" :duration="100" class="swiper" @animationfinish="animationfinish">
				<swiper-item>
					<image class="swiper-item" src="../../static/yindaoye/q1.jpg"></image>
				</swiper-item>
				<swiper-item>
					<image class="swiper-item" src="../../static/yindaoye/q2.jpg"></image>
				</swiper-item>
				<swiper-item>
					<image class="swiper-item" src="../../static/yindaoye/q3.jpg"></image>
				</swiper-item>
				<swiper-item>
					<image class="swiper-item" src="../../static/yindaoye/q4.jpg"></image>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				qidongye: 2,
				qidongyes: '',
				token: ''
			}
		},
		onLoad() {
			//uni.clearStorageSync();
			this.qidongyes = uni.getStorageSync('qidongye');
			this.token = uni.getStorageSync('token');
			console.log(this.qidongyes)
			console.log(this.token)
			if (this.qidongyes && this.qidongyes == 1 && this.token) {
				//plus.navigator.closeSplashscreen()
				uni.showTabBar();
			} else {
				uni.hideTabBar();
			}
		},
		onShow() {
			if (this.qidongyes && this.token) {
				this.qidongye = 1;
			}
		},
		methods: {
			animationfinish(e) {
				//判断到最后一张后，自动转向进入首页
				if (e.detail.current == 3) {
					setTimeout(function() {
						try {
							uni.setStorageSync('qidongye', 1);
						} catch (e) {

						};
						uni.redirectTo({
							url: '/pages/login/login'
						});
					}, 1000)
				}
			}
		}
	}
</script>
<style>
	.swiper,.swiper swiper-item, .swiper-item{
		width: 100%;
		height: 100%;
	}
	.content{
		position: absolute;
		top:0;
		right: 0;
		left: 0;
		bottom: 0;
		height: auto;
		width: 100%;
		z-index: 1;
	}
	.contents {
		height: 1000rpx;
		background-color: #4CD964;
	}
	
</style>
